<SCRIPT LANGUAGE="JavaScript">    

    function swap_jobseeker(temp)
    {
        document.getElementById('jobseeker_testimonials').innerHTML = document.getElementById('jobseeker'+temp).innerHTML;
    }
    
    function swap_employer(temp)
    {
        document.getElementById('employer_testimonials').innerHTML = document.getElementById('employer'+temp).innerHTML;
    }    
    
    function tampil()
    {
        $("#form_quote").slideDown("slow");
    }
    function sembunyi()
    {
        $("#form_quote").slideUp("fast");
    }
</SCRIPT> 

<?php
e($javascript->link('jquery.js'));    
echo "<div class='form'>";    
    echo "<h2> Testimonials from members </h2>";
    echo "<hr color='#2A7EF7'>";
    
    $quote = '"';
    $quote = "<font style='font-size:120%'><b>".$quote."</b></font>";
    
    $style2="
        border-bottom:2px solid #bbb;
        padding-left:25px;
        height:75px;
        overflow:auto;    
    ";
    
    $style3="
        margin-top:20px;        
        margin-left:60px;        
    ";
    
    if(@$_SESSION['User'])
    {
        echo "<div style='margin-left:1040px;margin-top:20px'><a class='sky' style='cursor:pointer' onClick='tampil()'>[ Leave a Quote ]</a></div>";
        echo "<div id='form_quote' style='position:absolute;margin-left:705px;padding:10px;border:2px solid #bbb;width:430px;display:none'>";
            echo $form->create('Testimonial',array('controller'=>'testimonials','action'=>'post'));
            echo "<table>";
            echo "<tr><td>&nbsp</td><td colspan='2'><h3> Testimonial </h3></td><td>&nbsp</td></tr>";
            echo "<tr><td style='vertical-align:top;'>".$quote."</td><td  colspan='2'><textarea name='data[Testimonial][desc]' style='width:400px;height:80px;'></textarea></td><td style='vertical-align:bottom;'>".$quote."</td></tr>";
            echo "<tr><td>&nbsp</td><td style='text-align:left;'><a class='sky' style='cursor:pointer' onClick='sembunyi()'>[ Cancel ]</a></td><td style='text-align:right;'><input type='submit' value='Post'></td><td>&nbsp</td></tr>";
            echo "</table>";
        echo "</div>";
    }





    echo "<div style='$style3'><h3>From Jobseekers</h3></div>";
    echo "<div id='jobseeker_testimonials'>";
    echo "</div>";
        $i=1;
        foreach($jobseeker_testimonials as $testimonial)
        {
            echo "<div id='jobseeker".$i."' style='display:none'>";
                echo "<b>".$testimonial['jobseekers']['salution']." ".$testimonial['jobseekers']['first_name']." ".$testimonial['jobseekers']['last_name']."</b>";
                echo "<div style='$style2'>";
                echo $quote."<i>".$testimonial['testimonials']['desc']."</i>".$quote;
                echo "</div>";
                if($i==count($jobseeker_testimonials))
                { $i=0; }
                echo "<div style='float:right;'><a style='cursor:pointer' onClick='swap_jobseeker(".($i+1).")'> <b> Next </b> </a></div>"; 
                $i++;
            echo "</div>";
        }
    
    if(count($jobseeker_testimonials)) 
    {
    ?>
        <SCRIPT LANGUAGE="JavaScript">    
            document.getElementById('jobseeker_testimonials').innerHTML = document.getElementById('jobseeker1').innerHTML;
        </SCRIPT>     
    <?php
    }
    
    echo "<div style='$style3'><h3>From Employers</h3></div>";
    echo "<div id='employer_testimonials'>";    
    echo "</div>";
        $i=1;
        foreach($employer_testimonials as $testimonial)
        {
            echo "<div id='employer".$i."' style='display:none'>";
                echo "<b>".$testimonial['employers']['salution']." ".$testimonial['employers']['full_name']." </b> - ".$testimonial['employers']['company_name']."";
                echo "<div style='$style2'>";
                echo $quote."<i>".$testimonial['testimonials']['desc']."</i>".$quote;
                echo "</div>";
                if($i==count($employer_testimonials))
                { $i=0; }
                echo "<div style='float:right;'><a style='cursor:pointer' onClick='swap_employer(".($i+1).")'> <b> Next </b> </a></div>"; 
                $i++;
            echo "</div>";
        }
    
    if(count($employer_testimonials)) 
    {
    ?>
        <SCRIPT LANGUAGE="JavaScript">    
            document.getElementById('employer_testimonials').innerHTML = document.getElementById('employer1').innerHTML;
        </SCRIPT>     
    <?php
    }    

echo "</div>"; 
?>

